home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / MacSource / sysMacPict.c < prev    next >
Encoding:
Text File  |  1996-10-07  |  4.8 KB  |  239 lines  |  [TEXT/CWIE]

  1. /*==============================================================================
  2. Project:    POV
  3.  
  4. Version:    3
  5.  
  6. File:    sysMacPict.c
  7.  
  8. Description:
  9. This module contains the code to read/write Mac PICT image files.
  10. (System-dependent image_map file format read/write routines - for Macintosh PICT)
  11. ------------------------------------------------------------------------------
  12. Author:
  13.     Eduard [esp] Schwan
  14. ------------------------------------------------------------------------------
  15.     from Persistence of Vision(tm) Ray Tracer
  16.     Copyright 1996 Persistence of Vision Team
  17. ------------------------------------------------------------------------------
  18.     NOTICE: This source code file is provided so that users may experiment
  19.     with enhancements to POV-Ray and to port the software to platforms other 
  20.     than those supported by the POV-Ray Team.  There are strict rules under
  21.     which you are permitted to use this file.  The rules are in the file
  22.     named POVLEGAL.DOC which should be distributed with this file. If 
  23.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  24.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  25.     Forum.  The latest version of POV-Ray may be found there as well.
  26.  
  27.     This program is based on the popular DKB raytracer version 2.12.
  28.     DKBTrace was originally written by David K. Buck.
  29.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  30. ------------------------------------------------------------------------------
  31. Change History:
  32.     960123    [esp]    Created
  33. ==============================================================================*/
  34.  
  35. #undef POV_COMMENTS // turn on for internal comment stamping
  36.  
  37. #include "frame.h"
  38. #include "povproto.h"
  39. #include "povray.h"
  40. #include "optout.h"
  41. #include "sysMacPict.h"
  42.  
  43. /*****************************************************************************
  44. *
  45. * FUNCTION
  46. *
  47. * INPUT
  48. *
  49. * OUTPUT
  50. *
  51. * RETURNS
  52. *
  53. * AUTHOR
  54. *
  55. * DESCRIPTION
  56. *
  57. * CHANGES
  58. *
  59. ******************************************************************************/
  60.  
  61. static int MacPICT_Line_Number;
  62.  
  63. FILE_HANDLE *Get_MacPICT_File_Handle()
  64. {
  65.   FILE_HANDLE *handle;
  66.  
  67.   handle = (FILE_HANDLE *) POV_MALLOC(sizeof(FILE_HANDLE), "MacPICT file handle") ;
  68.  
  69.   handle->Open_File_p = Open_MacPICT_File;
  70.   handle->Write_Line_p = Write_MacPICT_Line;
  71.   handle->Read_Line_p = Read_MacPICT_Line;
  72.   handle->Read_Image_p = Read_MacPICT_Image;
  73.   handle->Close_File_p = Close_MacPICT_File;
  74.  
  75.   handle->file = NULL;
  76.   handle->buffer = NULL;
  77.   handle->buffer_size = 0;
  78.  
  79.   return (handle);
  80. }
  81.  
  82. /*****************************************************************************
  83. *
  84. * FUNCTION
  85. *
  86. * INPUT
  87. *   
  88. * OUTPUT
  89. *   
  90. * RETURNS
  91. *   
  92. * AUTHOR
  93. *   
  94. * DESCRIPTION
  95. *
  96. * CHANGES
  97. *
  98. ******************************************************************************/
  99.  
  100. int Open_MacPICT_File(handle, name, width, height, buffer_size, mode)
  101. FILE_HANDLE *handle;
  102. char *name;
  103. int *width;
  104. int *height;
  105. int buffer_size;
  106. int mode;
  107. {
  108. printf("Sorry, opening Mac PICT files is not yet implemented.\n");
  109. }
  110.  
  111. /*****************************************************************************
  112. *
  113. * FUNCTION
  114. *
  115. * INPUT
  116. *
  117. * OUTPUT
  118. *
  119. * RETURNS
  120. *
  121. * AUTHOR
  122. *   
  123. * DESCRIPTION
  124. *
  125. * CHANGES
  126. *
  127. ******************************************************************************/
  128.  
  129. void Write_MacPICT_Line(handle, line_data, line_number)
  130. FILE_HANDLE *handle;
  131. COLOUR *line_data;
  132. int line_number;
  133. {
  134. }
  135.  
  136. /*****************************************************************************
  137. *
  138. * FUNCTION
  139. *
  140. * INPUT
  141. *
  142. * OUTPUT
  143. *
  144. * RETURNS
  145. *
  146. * AUTHOR
  147. *
  148. * DESCRIPTION
  149. *
  150. * CHANGES
  151. *
  152. ******************************************************************************/
  153.  
  154. int Read_MacPICT_Line(handle, line_data, line_number)
  155. FILE_HANDLE *handle;
  156. COLOUR *line_data;
  157. int *line_number;
  158. {
  159. }
  160.  
  161. /*****************************************************************************
  162. *
  163. * FUNCTION
  164. *
  165. * INPUT
  166. *
  167. * OUTPUT
  168. *
  169. * RETURNS
  170. *
  171. * AUTHOR
  172. *
  173. * DESCRIPTION
  174. *
  175. * CHANGES
  176. *
  177. ******************************************************************************/
  178.  
  179. void Close_MacPICT_File(handle)
  180. FILE_HANDLE *handle;
  181. {
  182.   if (handle == NULL)
  183.     return;
  184.  
  185.   if (handle->file)
  186.   {
  187.     fflush(handle->file);
  188.     fclose(handle->file);
  189.   }
  190.  
  191.   if (handle->buffer != NULL)
  192.   {
  193.     POV_FREE(handle->buffer);
  194.   }
  195.  
  196.   handle->file = NULL;
  197.   handle->buffer = NULL;
  198. }
  199.  
  200. /*****************************************************************************
  201. *
  202. * FUNCTION
  203. *
  204. * INPUT
  205. *
  206. * OUTPUT
  207. *
  208. * RETURNS
  209. *
  210. * AUTHOR
  211. *
  212. * DESCRIPTION
  213. *
  214. * CHANGES
  215. *
  216. ******************************************************************************/
  217.  
  218. void Read_MacPICT_Image(Image, name)
  219. IMAGE *Image;
  220. char *name;
  221. {
  222.   char type;
  223.   int width, height;
  224.   int depth;
  225.   char input;
  226.   char junk[512];
  227.   int x, y;
  228.   int data;
  229.   IMAGE_LINE *line_data;
  230.   FILE *infile;
  231.  
  232.   if ((infile = Locate_File(name, READ_FILE_STRING, ".pict", ".PICT", true)) == NULL)
  233.   {
  234.     Error("Error opening MacPICT image %s.\n", name);
  235.   }
  236.  
  237.   fclose(infile);
  238. }
  239.